<template>
  <a-sub-menu :key="menuInfo.key" v-bind="$attrs">
    <template #title>
      <span>
        <MailOutlined /><span>{{ menuInfo.name }}</span>
      </span>
    </template>
    <template v-for="item in menuInfo.children" :key="item.id">
      <template v-if="!item.children">
        <a-menu-item :key="item.id">
          <PieChartOutlined />
          <span>{{ item.name }}</span>
        </a-menu-item>
      </template>
      <template v-else>
        <sub-menu :menu-info="item" :key="item.id" />
      </template>
    </template>
  </a-sub-menu>
</template>

<script>
import { PieChartOutlined, MailOutlined } from "@ant-design/icons-vue"
export default {
  name: "SubMenu",
  props: {
    menuInfo: {
      type: Object,
      default: () => ({})
    }
  },
  components: {
    PieChartOutlined,
    MailOutlined
  }
}
</script>

<style></style>
